import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TelContactVO, TelContactForm, TelContactQuery } from '@/api/device/telContact/types';

/**
 * 查询话机联系人列表
 * @param query
 * @returns {*}
 */

export const listTelContact = (query?: TelContactQuery): AxiosPromise<TelContactVO[]> => {
  return request({
    url: '/device/telContact/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询话机联系人详细
 * @param id
 */
export const getTelContact = (id: string | number): AxiosPromise<TelContactVO> => {
  return request({
    url: '/device/telContact/' + id,
    method: 'get'
  });
};

/**
 * 新增话机联系人
 * @param data
 */
export const addTelContact = (data: TelContactForm) => {
  return request({
    url: '/device/telContact',
    method: 'post',
    data: data
  });
};

/**
 * 修改话机联系人
 * @param data
 */
export const updateTelContact = (data: TelContactForm) => {
  return request({
    url: '/device/telContact',
    method: 'put',
    data: data
  });
};

/**
 * 删除话机联系人
 * @param id
 */
export const delTelContact = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/telContact/' + id,
    method: 'delete'
  });
};
